{% extends "default.html" %}

{% block content %}


<div class="title">
	Venta
</div>
<div class="content">

{% if request.show %}
	<div id="sale_done">
		Venta registrada correctamente.<br><a href="javascript:show_sale({{ request.show }});">Ver detalle</a>
	</div>
{% endif %}
	
	<div>Registro de Venta</div>
	<form action="/sales/sell/" method="post" id="sale_form">
		<table id="sale_table">
			<tr>
				<th>Cliente</th>
				<td></td>
				<td>
					{% if request.clients %}
					<select name="client">
						{% for c in request.clients %}
							<option value="{{ c.id }}">{{ c.user.first_name }} {{ c.user.last_name }} </option>
						{% endfor %}
					</select>
					{% endif %}
				</td>
				<td>
					<a href="/staff/clients/">Registrar Cliente</a>
				</td>
			</tr>
			<tr>
				<th>Fecha</th>
				<td>{% now "d \de F \de Y" %}</td>
				<th>Hora</th>
				<td>{% now "f" %}</td>
			</tr>
			<tr>
				<th colspan="4">Art&iacute;culos vendidos</th>
			</tr>
			<tr>
				<td colspan="4">
					<div id="articles"></div>
					<div id="vinyls"></div>
					<div id="wheels"></div>
					<div id="sell_recount">Ninguno seleccionado</div>
				</td>
			</tr>
			<tr>
				<th>Modalidad de pago</th>
				<td>
					<select name="payment_method" id="payment_method">
						<option value="1">Al Contado</option>
						<option value="0">Al Cr&eacute;dito</option>
					</select>
				</td>
				<th>N&uacute;mero de Factura</th>
				<td>
					<input type="text" name="bill_number" id="bill_number">
				</td>
			</tr>
			<tr>
				<th>Descuento</th>
				<td>
					<input type="text" name="discount" id="discount">
					<select name="discount_currency" id="discount_currency" >
						{% for c in request.currencies %}
						<option value="{{ c.id }}">{{ c.symbol }}</option>
						{% endfor %}
					</select>
				</td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td colspan="4" id="done_button"><input type="submit" value="Efectuar Venta"></td>
			</tr>
		</table>
	</form>
	<div>Busque aqu&iacute; los artículos de venta</div>
	<table id="table_search">
		<tr>
			<th>Texto de b&uacute;squeda</th>
			<th><input type="text" id="text_search"></th>
			<th><input type="button" value="Buscar" id="btn_search"></th>
			<th>
				<select id="type_search">
					<option value="1">Tipo de &iacute;tem</option>
					<option value="2">&Iacute;tem</option>
					<option value="3">Vinilos</option>
					<option value="4">Ruedas</option>
				</select>
			</th>
		</tr>
		<tr>
			<td colspan="4"><div id="result_search">No hay resultados</div></td>
		</tr>
	</table>
</div>
{% endblock %}